package org.zhenggn.guawa;

import com.google.common.util.concurrent.RateLimiter;

/**
 * Created by zhenggn on 2017/8/27.
 */
public class Test {
    public static void main(String[] args) {
        Test test = new Test();
        test.limit();
    }

    public void limit() {
        final RateLimiter limit = RateLimiter.create(5);
        for (int i = 0; i < 10; i++) {
            double waitTime = limit.acquire();
            System.out.println(waitTime);
        }
    }
}
